import request from '@/utils/request'

// 订单结算
export const checkoutOrder = (mode, obj) => {
  return request.get('/checkout/order', {
    params: {
      mode,
      delivery: 10,
      shopId: 0,
      couponId: 0,
      isUsePoints: 0,
      // 将传过来的参数对象 动态展开
      ...obj
    }
  })
}

// 提交订单
export const checkoutSubmit = (obj) => {
  return request.post('checkout/submit', {
    delivery: 10,
    couponId: 0,
    isUsePoints: 0,
    payType: 10,
    ...obj
  })
}

// 查询订单列表
export const selOrderList = (dataType) => {
  return request.get('order/list', {
    params: {
      dataType: dataType,
      page: 1
    }
  })
}

// 取消订单
export const cancelOrder = (orderId) => {
  return request.post('order/cancel', {
    orderId
  })
}
